package com.lz.homedecoration.common.response;

import lombok.Data;

@Data
public  class ResultRes {
    private Object data;
    private String message;
    private int code;

    public ResultRes(Object data, String message, int code) {
        this.data = data;
        this.message = message;
        this.code = code;
    }

    public static ResultRes success(Object data, String message, int code){
        ResultRes resultRes = new ResultRes(data,message,code);
        return  resultRes;
    }
    public static ResultRes success(Object data,String message){
        ResultRes resultRes = new ResultRes(data,message,1);
        return  resultRes;
    }
    public static ResultRes success(Object data){
        ResultRes resultRes = new ResultRes(data,"操作成功",1);
        return  resultRes;
    }
    public static ResultRes success(){
        ResultRes resultRes = new ResultRes(null,"操作成功",1);
        return  resultRes;
    }
    public static ResultRes fail(Object data,String message, int code){
        ResultRes resultRes = new ResultRes(data,message,code);
        return  resultRes;
    }
    public static ResultRes fail(Object data,String message){
        ResultRes resultRes = new ResultRes(data,message,0);
        return  resultRes;
    }
    public static ResultRes fail(Object data){
        ResultRes resultRes = new ResultRes(data,"操作失败",0);
        return  resultRes;
    }
    public static ResultRes fail(){
        ResultRes resultRes = new ResultRes(null,"操作失败",0);
        return  resultRes;
    }
}
